package startupcompanymanager2012;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Locale;
import javax.swing.Timer;
//Copy of Test, runs as core for the moment, to access office and calendar and as reference.
//if we add the save/load function.....we will keep it in some form.
public class Core {

    //Calendar for development, years, 12 months, 30 days
    public static projectCalendar calendar = new projectCalendar();
    //ArrayList containing all of the devs in your team 
    public static ArrayList<Developer> devs = new ArrayList<Developer>();
    //ArrayList containing all of the games you started to code
    public static ArrayList<Game> games = new ArrayList<Game>();
    //ArrayList containing all of the side projects you did
    public static ArrayList<SideProject> projc = new ArrayList<SideProject>();
    //Office object, (squaremeters, workstations, environmentQuality, description)
    public static Office office = new Office(24, 2, 33,
            "Small place, but everything beginns here");
    //variable for the companies capital    
    public static double capital = 1000;
    //boolean values for a game running and the gameStatus
    public static boolean running = false, gameOver = false;
    //boolean values for a sideproject running and if one is finished, important for different JFrames
    public static boolean runningSideProject = false, sideProjectFinished = true;
    //same as sideprojects
    public static boolean runningGameDev = false, gameDevFinished = true;
    //Color representing sideproject status, has to be moved and/or changed
    public static Color sideProjectStatus = Color.red;
    //integer representing sideproject number chosen from array, has to be moved and/or changed
    public static int runningSideProjectNum = 0;
    //Company names string
    public static String companyName;
    //numberformat for $
    public static NumberFormat nfmt = NumberFormat.getCurrencyInstance(Locale.US);
    //delay for the caldendarTimer
    private static final int DELAY = 2000;
    //the timer for the projectCalendar 
    public static Timer calendarTimer = new Timer(DELAY, null);

    public static void init(String[] args) {
        // DO NOT TOUCH!
    }
    //Method that starts the calendarTimer

    public static void startCalendar() {
        TimeListener timeListener = new TimeListener();
        calendarTimer.addActionListener(timeListener);
        calendarTimer.start();

    }
    //Actionlistener that adds one day to the calendar and updates the calendar string

    public static class TimeListener implements ActionListener {

        public void actionPerformed(ActionEvent e) {
            calendar.addDays(1);
            StartupCompanyManager2012View.livelDate.setText(calendar.toString());
        }
    }
    //disables all content in the JFrame if the game is lost
    public static void GameOver() {

        StartupCompanyManager2012View.mProjectsButton.setEnabled(false);
        StartupCompanyManager2012View.mStaffButton.setEnabled(false);
        StartupCompanyManager2012View.cInfoButton.setEnabled(false);
        StartupCompanyManager2012View.mCompanyButton.setEnabled(false);
        running = false;
        gameOver = true;
    }
}
